$TITLE  Minimal model formulated in MPSGE  -- August, 2003  (Mark Horridge and Thomas Rutherford)

*         1. Sector-specific capital.
*         2. All elements of investment and government demand are fixed.
*         3. Fixed aggregate consumption with unconstrained trade balance.
*         4. Fixed real wage defined in terms of the consumer price index.

*         Scenario involes a 1% increase in the real wage.

*         Read the relabeled dataset:

$gdxin 'min-alt1.gdx'

SET       SRC                 Source of commodities,
          USER                All users,
          FAC                 Primary factors;

$LOAD SRC USER FAC 

set       IND(USER) Industries;

$LOAD IND

ALIAS (IND,COM);

set       FD(USER)  Final demands /Investment, Households, Government/;

PARAMETER  
          USE(COM,SRC,USER)   USE matrix [[USE :COM*SRC*USER]],
          FACTOR(FAC,IND)               Wages and profits [[1FAC:FAC*IND]],
          V0MTX(COM)                    Import tax revenue [[0TAR:COM]],
          V1PTX(IND)                    Production tax revenue [[1PTX:IND]],

          SIGMA(COM)                    Armington elasticities [[ARM :COM]],
          SIGMA1PRIM(IND)               Primary factor substitution elasticity [[P028:IND]],
          EXP_ELAST(COM)                Export demand elasticities [[P018:COM]];

$load USE FACTOR V0MTX V1PTX SIGMA SIGMA1PRIM EXP_ELAST

PARAMETER
          V1TOT(IND)          Industry output,
          USE_CS(USER)        Final demand,
          V0CIF(COM)          Imports (net of tariff),

          TY(IND)             Output tax rate,
          TM(COM)             Import tariff rate,

          PM0(COM)  Import price level,

          E0(COM)             Exports,
          ESUB(FD)  Elasticities /Households 1/,
          BOPDEF              Balance of payments deficit,
          WAGERATE  Target wage rate (determines unemployment) /1/;

V0CIF(COM) = SUM(USER, USE(COM,"imp",USER)) - V0MTX(COM);
V1TOT(IND) = SUM(COM, USE(COM,"dom",IND) + USE(COM,"imp",IND)) 
          + SUM(FAC, FACTOR(FAC,IND)) + V1PTX(IND);
USE_CS(USER) = SUM(COM, USE(COM,"dom",USER) + USE(COM,"imp",USER));

TM(COM)$V0CIF(COM) = V0MTX(COM) / V0CIF(COM);
PM0(COM) = 1 + TM(COM);
TY(IND) = V1PTX(IND) / V1TOT(IND);

E0(COM) = USE(COM,"dom","Exports");
BOPDEF = SUM(COM, V0CIF(COM) - E0(COM));
display BOPDEF;

$ontext

$MODEL:MINIMAL

$SECTORS:
          y(IND)    ! Production activity level
          m(COM)    ! Import activity level
          x(FD)     ! Final demand (investment - government - household)

$COMMODITIES:
          px(FD)    ! Price index for final demand
          pd(COM)   ! Domestic price level
          pm(COM)   ! Import price level
          pl        ! Wage rate
          rk(IND)   ! Return to sector-specific capital
          pfx       ! Relative price of foreign exchange

$CONSUMERS:
          ra        ! Representative agent

$AUXILIARY:
          e(COM)$E0(COM)      ! Export index
          fob                 ! FOB value of exports
          b                   ! Index of trade balance
          u                   ! Unemployment      
          
$PROD:y(IND)  s:0 COM.tl:SIGMA(COM)  va:SIGMA1PRIM(IND)
          O:pd(IND) Q:V1TOT(IND)                            A:ra      T:TY(IND)
          I:pd(COM) Q:USE(COM,"dom",IND)          COM.tl:
          I:pm(COM) Q:USE(COM,"imp",IND)          COM.tl:   
          I:pl                Q:FACTOR("Labour",IND)        va:
          I:rk(IND) Q:FACTOR("Capital",IND)       va:

$REPORT:
          V:dl(IND) I:pl                PROD:y(IND)
          V:dm(COM,IND)       I:pm(COM) PROD:y(IND)
          V:dd(COM,IND)       I:pd(COM) PROD:y(IND)

$PROD:m(COM)
          O:pm(COM) Q:(V0CIF(COM)*PM0(COM))
          I:pfx               Q:V0CIF(COM)                  A:ra  T:TM(COM)  P:PM0(COM)

$PROD:x(FD)  s:ESUB(FD)  COM.tl:SIGMA(COM)
          O:px(FD)  Q:USE_CS(FD)
          I:pd(COM) Q:USE(COM,"dom",FD) COM.tl:
          I:pm(COM) Q:USE(COM,"imp",FD) COM.tl:

$DEMAND:ra  
          D:px("Households")  Q:USE_CS("Households")
          E:rk(IND)           Q:FACTOR("Capital",IND)
          E:pl                          Q:(SUM(IND, FACTOR("Labour",IND)))
          E:px("Government")  Q:(-USE_CS("Government"))
          E:px("Investment")  Q:(-USE_CS("Investment"))
          E:pd(COM)           Q:(-E0(COM))                                      R:e(COM)
          E:pfx                         Q:1                                               R:fob
          E:pl                          Q:(-SUM(IND, FACTOR("Labour",IND)))     R:u

          E:pfx                         Q:BOPDEF                                R:b

$CONSTRAINT:e(COM)$E0(COM)
          e(COM) =E= (pfx/pd(COM))**EXP_ELAST(COM);

$CONSTRAINT:fob
          fob =E= SUM(COM, e(COM)*E0(COM));

$CONSTRAINT:b
          x("Households") =E= 1;
          
$CONSTRAINT:u
          pl =E= WAGERATE * px("Households");

$offtext
$SYSINCLUDE mpsgeset MINIMAL

u.lo = -inf;
b.lo = -inf;

u.L = 0;
b.L = 1;

e.L(COM) = 1;
fob.L = SUM(COM, E0(COM));

MINIMAL.iterlim = 0;

$INCLUDE MINIMAL.GEN  
SOLVE MINIMAL USING MCP;

PARAMETER PCTDD     Percentage change in total demand for domestic inputs,
                    PCTDM     Percentage change in total demand for imported inputs,
                    PCTad     Percentage change in unit demand for domestic inputs,
                    PCTam     Percentage change in unit demand for imported inputs,
                    dd0       Benchmark demand for domestic inputs,
                    dm0       Benchmark demand for imported inputs;
                    
dd0(com,ind) = DD.L(com,ind);
dm0(com,ind) = DM.L(com,ind);

PARAMETER SUMMARY             SUMMARY RESULTS OF % IMPACTS ;

SUMMARY(COM,"Tariff") = 100 * TM(COM);

*         Perform a wage increase:

wagerate = 1.01;

MINIMAL.iterlim = 10000;
$INCLUDE MINIMAL.GEN  
SOLVE MINIMAL USING MCP;

DISPLAY dd.l, dm.l;
PCTDD(com,ind)$dd0(com,ind) = 100 * (DD.L(com,ind)/dd0(com,ind)-1);
PCTDM(com,ind)$dm0(com,ind) = 100 * (DM.L(com,ind)/dm0(com,ind)-1);
display pctdd, pctdm;

PCTad(com,ind)$dd0(com,ind) = 100 * ((DD.L(com,ind)/Y.L(ind))/dd0(com,ind)-1);
PCTam(com,ind)$dm0(com,ind) = 100 * ((DM.L(com,ind)/Y.L(ind))/dm0(com,ind)-1);
display pctad, pctam;



PARAMETER SUMMARY             SUMMARY RESULTS OF % IMPACTS ;
SUMMARY(IND,"OUTPUT") = 100 * (y.L(IND)-1);
SUMMARY(COM,"IMPORT") = 100 * (m.L(COM)-1);
SUMMARY(COM,"EXPORT") = 100 * (e.L(COM)-1);
SUMMARY(IND,"EMPLOY") = 100 * (dl.L(IND)/FACTOR("Labour",IND)-1);
SUMMARY(COM,"PRICE") = 100 * (pd.L(COM)/pfx.l-1);
OPTION SUMMARY:6;
DISPLAY SUMMARY;
